package com.wbao.dianniu.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout.LayoutParams;

import com.bumptech.glide.Glide;
import com.polites.android.GestureImageView;
import com.umeng.analytics.MobclickAgent;
import com.wbao.dianniu.logical.GlobalContext;
import com.wbao.dianniu.R;

/**
 * 查看头像大图 
 * 
 * @author yejianjun
 *
 */
public class HeadInfoViewActivity extends Activity {

	protected GestureImageView mView;
	ViewGroup layout;
	LayoutParams params;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.common_image_view);
		mView = new GestureImageView(this);
		layout  = (ViewGroup) findViewById(R.id.image_gesture_layout);
		params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		params.gravity = Gravity.CENTER;
		Intent intent = getIntent();
		String headUrl = intent.getStringExtra(GlobalContext.BUNDLE_HEADPIC);
		if(TextUtils.isEmpty(headUrl)){
			mView.setImageResource(R.drawable.default_head_icon);
			mView.setLayoutParams(params);
			 layout.addView(mView);
		}else{
			 layout.addView(mView);
			String downUrl = GlobalContext.cdndownUrl + headUrl /*+ "@1000-1ci.png"*/;
			Glide.with(this)
			.load(downUrl)
			.into(mView);
			
		}
      
	}
	public void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
		}
		public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
		}
}
